<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<!--<head th:replace="~{fragments/header :: header}"> </head>-->

<body>
<div class="container">
    <div class="mt-3">
        <h2>Hello Spring Security</h2>
    </div>
    <div sec:authorize="isAuthenticated()" th:if="${principal}" th:object="${principal}">
        <p>已有用户登录</p>
        <p>登录的用户为: <span sec:authentication="name"></span></p>
        <p>用户权限为: <span th:text="*{userAuthentication.authorities}"></span></p>
        <p>用户头像为: <img alt="" class="avatar width-full rounded-2" height="230" th:src="*{userAuthentication.details.avatar_url}" width="230"></img></p>

    </div>
    <div sec:authorize="isAnonymous()">
        <p>未有用户登录</p>
    </div>
</div>
<!-- /.container -->

<!--<div th:replace="~{fragments/footer :: footer}">...</div>-->
</body>
</html>